//
//  FViewController.m
//  FAJF
//
//  Created by zhaoxiaoxu on 16/1/22.
//  Copyright © 2016年 mehekeji. All rights reserved.
//

#import "FViewController.h"

@interface FViewController ()

@end

@implementation FViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    _dataSource= [[NSMutableArray alloc]initWithObjects:@"1",@"2",@"3",nil];
    // Do any additional setup after loading the view.
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 3;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section == 0) {
        return _dataSource.count;
    }else if (section == 1){
        return _dataSource.count;
    }else{
    
        return _dataSource.count;
    }
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:( NSIndexPath *)indexPath
{
    if (indexPath.row == 0){
        return 167;
    }if(indexPath.row == 1)
    {
        return 167;
    }
    else{
        return 167;
    }
    
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0) {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"one"];
        return cell;
    }else if(indexPath.section  == 1){
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"two"];
        return cell;
    }else{
            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"three"];
            return cell;
    }
}
-(UIView *) tableView : (UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView * headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
    headerView.backgroundColor = [UIColor redColor];
    
    return headerView;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView beginUpdates];
    
    [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationLeft];
    [_dataSource removeObjectAtIndex:indexPath.row];
    
    [self.tabelView endUpdates];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
